package com.example.villagedevelop.generator.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.villagedevelop.generator.entity.VideoHouse;
import com.example.villagedevelop.generator.mapper.VideoHouseMapper;
import com.example.villagedevelop.generator.service.VideoHouseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class VideoHouseServiceImpl extends ServiceImpl<VideoHouseMapper, VideoHouse> implements VideoHouseService {
    @Autowired
    VideoHouseMapper videoHouseMapper;

    //根据hid查找videos
    @Override
    public List<String> getVideoesByHid(int hid) {
        List<String> videoFiles = new ArrayList<>();
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("h_id",hid);
        List<VideoHouse> videoHouseList = videoHouseMapper.selectList(wrapper);
        for (VideoHouse videoHouse:videoHouseList){
            videoFiles.add(videoHouse.getVideoFile());
        }
        return videoFiles;
    }
}
